//
//  FileParse.h
//  ConstructGccfg2.0
//
//  Created by Bryce Holton on 12/8/12.
//  Copyright (c) 2012 Bryce Holton. All rights reserved.
//

#ifndef __ConstructGccfg2_0__FileParse__
#define __ConstructGccfg2_0__FileParse__

#include <iostream>
#include <fstream>
#include "common.h"
#include "ControlFlowGraph.h"
#include "ProgramFunction.h"

class FileParse
{
public:
    FileParse(string);
    ~FileParse();
    ProgramFunction *ParseFunction();
    
private:
    ifstream inputFile;
    void GetStringFromFile(string &);
    void BuildBasicBlocks(string &, ControlFlowGraph &);
    void BuildFunctionLoops(string &, ProgramFunction &);
    void ConnectBasicBlocks(string &, ControlFlowGraph &);
    int InsertCodeIntoBasicBlocks(string &, ControlFlowGraph &);
    BasicBlock *RemoveReferencesToUneededBlocks(ControlFlowGraph &);
};

#endif /* defined(__ConstructGccfg2_0__FileParse__) */
